﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using BFTest.Ammunitions;
using BFTest.Services;

namespace BFTest.Collision
{
    struct BulletCollision
    {
        public int bulletID;

        public int ownerID;

        public BulletType bulletType;

        public int bulletDamage;

        public int victimID;

        public void NotifyParties(IBattlefieldService bfs)
        {
            if( ownerID != victimID)
                bfs.GetUnitByID(victimID).ModifyHealth(-bulletDamage);
        }


        public static BulletCollision MakeCollision(CBullet bullet, ICollideable victim)
        {

            BulletCollision bc = new BulletCollision();
            bc.bulletID = bullet.ID;
            bc.bulletType = bullet.BulletType;
            bc.ownerID = bullet.OriginID;
            if (victim != null)
                bc.victimID = victim.ID;
            else
                bc.victimID = -1;
            bc.bulletDamage = bullet.Damage;
            return bc;
        }
    }
}
